/**
 * 
 */
package TestCases;

import Tracer.*;
import XMLScene.RTSphere;
import XMLScene.RTSurface;
import junit.framework.TestCase;

/**
 * @author Hongyi Zhao
 * 
 */
public class RTSphereTest extends TestCase {
	private RTSphere sphere = null;

	/**
	 * @param name
	 */
	public RTSphereTest(String name) {
		super(name);
	}
	
	protected void setUp() throws Exception {
		super.setUp();

		sphere = new RTSphere(new RTVector(0.0f, 1.0f, -3.0f), 10.0);
		sphere.setPole(new RTVector(0.0f, 3.0f, 4.0f));
		sphere.setEquator(new RTVector(1.0f, 1.0f, 0.0f));

	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	/**
	 * Test method for setSurface Test it works well after performing setSurface
	 */
	public final void testSetSurface() {
		RTSurface surface = new RTSurface(new RTColor(0.0f, 0.0f, 0.0f));
		sphere.setSurface(surface);
		assertNotNull(sphere.getSurface());
	}

	/**
	 * Test method for setPole Test it works well after performing setPole
	 */
	public final void testSetPole() {
		RTVector pole = new RTVector(0.0f, 1.0f, 0.0f);
		sphere.setPole(pole);
		assertNotNull(sphere.getPole());
		assertTrue(sphere.getPole().isEqual(new RTVector(0.0f, 1.0f, 0.0f)));
	}

	/**
	 * Test method for setEquator Test it works well after performing setEquator
	 */
	public final void testSetEquator() {
		RTVector equator = new RTVector(0.0f, -1.0f, 0.0f);
		sphere.setEquator(equator);
		assertNotNull(sphere.getEquator());
		assertTrue(sphere.getEquator().isEqual(new RTVector(0.0f, -1.0f, 0.0f)));
	}

	/**
	 * Test method for getSurface Test it works well after performing getSurface
	 */
	public final void testGetSurface() {
	}

	/**
	 * Test method for getLocation Test it works well after performing
	 * getLocation
	 */
	public final void testGetLocation() {
		assertTrue(sphere.getLocation()
				.isEqual(new RTVector(0.0f, 1.0f, -3.0f)));
	}

	/**
	 * Test method for getPole Test it works well after performing getPole
	 */
	public final void testGetPole() {
		assertTrue(sphere.getPole().isEqual(new RTVector(0.0f, 3.0f, 4.0f)));
	}

	/**
	 * Test method for getEquator Test it works well after performing getEquator
	 */
	public final void testGetEquator() {
		assertTrue(sphere.getEquator().isEqual(new RTVector(1.0f, 1.0f, 0.0f)));
	}

	/**
	 * Test method for getRadius Test it works well after performing getRadius
	 */
	public final void testGetRadius() {
		assertEquals("radius error", (double) 10.0, sphere.getRadius());
	}
}
